FROM alpine:3.13.12 AS builder
RUN sed -i "s@dl-cdn.alpinelinux.org@mirrors.aliyun.com@g" /etc/apk/repositories \
&& apk --update add --no-cache gcc libwebsockets-dev libc-dev openssl-dev
ADD udp_to_websocket.c /tmp
RUN gcc -o /usr/local/bin/udp_to_websocket /tmp/udp_to_websocket.c -lwebsockets -lpthread

FROM alpine:3.13.12
RUN sed -i "s@dl-cdn.alpinelinux.org@mirrors.aliyun.com@g" /etc/apk/repositories \
&& apk --update add --no-cache libwebsockets
COPY --from=builder /usr/local /usr/local
